#include<stdio.h>
void F_sort(int* arr, int L, int R)
{
	if (L >= R)
	{
		return;
	}
	int left = L;
	int right = R;
	int First = arr[L];
	while (left < right)
	{
		while (left < right && arr[right] >= First)
		{
			right--;
		}
		if (left < right)
		{
			arr[left] = arr[right];
		}
		while (left < right && arr[left] <= First)
		{
			left++;
		}
		if (left < right)
		{
			arr[right] = arr[left];
		}
		if (left == right)
		{
			arr[left] = First;
		}
	}
	F_sort(arr, L, right - 1);
	F_sort(arr, right + 1, R);
}
int main()
{
	int arr[] = { 2,5,1,3,7,9,4,10,8 };
	F_sort(arr, 0, sizeof(arr) / sizeof(arr[0]) - 1);
	for(int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}